﻿using QYWXUpdate.DataModel;
using System.Data;
using static MyDapperApi.Services.DateBaseService;
using static MyDapperApi.Services.NetCommonService;

namespace MyDapperApi.Services;

public interface IDateBaseService
{
    Task<T> QueryFirstOrDefaultAsync<T>(string sql, SqlBuilder sqlBuilder, int type = 0, string db = "DefaultConnection");
    Task<List<T>> QueryAsync<T>(string sql, SqlBuilder sqlBuilder, int type = 0, string db = "DefaultConnection");
    Task<CommonResponse> ExecuteAsync(string sql, SqlBuilder? sqlBuilder = null, int type = 0, string db = "DefaultConnection");
    Task<CommonResponse> UpdateSpecifiedFields<T>(T entity, int dbtype = 0, string db = "DefaultConnection",
                              IDbTransaction transaction = null,
                              int? commandTimeout = null) where T : class;
    void CreateLog(string methodName, string className, string logMessage, int type);
    Task<CommonResponse> AddBaseService<T>(T entity, int dbtype = 0, string db = "DefaultConnection");
    Task<CommonResponse> PagingBaseService<T>(T entity,
                                                          int pageIndex, int pageSize,
                                                          Dictionary<string, string> PagingType = null,
                                                          string groupBy = "", string orderBy = "",
                                                          int dbtype = 0, string db = "DefaultConnection");
    Task<T> GetBaseService<T>(T entity, int is_deleted = 0, int dbtype = 0, string db = "DefaultConnection");
}